#pragma once

#include <list>
#include <vector>
#include <string>
#include <iostream>
#include <stdint.h>

#include "hdmap/math/VectorBase.hpp"
#include "hdmap/math/VolumeBase.hpp"

#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif

/**
 * @brief Navinfo namespace
 *
 */
namespace Navinfo
{
	namespace Engine
	{
		namespace DataSource
		{
			/// WGS-84 (in degrees) coordinate containing an x, y and z value
			//typedef Math::VectorBase< double, 3 > GeoCoord;
			typedef Navinfo::Engine::Math::VecBase3d GeoCoord;

			/// WGS84 bounding box
			typedef Navinfo::Engine::Math::AxisAlignedBoxBase< GeoCoord > GeoBox;	///< 
			typedef Navinfo::Engine::DataSource::CoordSegmentBase<GeoCoord> GeoSegment;	///< 
			typedef std::vector< GeoBox > GeoBoxQueue;								///< GeoBox queue
			typedef std::vector< GeoCoord > VertexList;								///< Container for GeoCoord
		}

		namespace DataSource
		{
			//typedef Navinfo::Engine::Math::VecBase2ll NdsCoord;						///< coordinate of NDS, express value use int64
			typedef Navinfo::Engine::Math::VecBase3ll NdsCoord;
			typedef NdsCoord NdsCoord3D;
			typedef Navinfo::Engine::DataSource::CoordSegmentBase<NdsCoord> NdsSegment;		///<

			typedef Navinfo::Engine::Math::AxisAlignedBoxBase< NdsCoord > NdsBox;	///< NDS coorination boundarybox
			typedef std::vector< NdsCoord > NdsVertexList;							///< NDS coordination list
		}

		namespace Math{

			const double kMathEpsilon = 1e-10;
			/**
			 *  @brief coordinates in 3D space.
			 *   x: represents the longitude in coordinates
			 *   Y: represents the latitude in coordinates
			 *   Z: represents the altitude in coordinates
			 */
			typedef Navinfo::Engine::DataSource::GeoCoord Vec3d;
			typedef Navinfo::Engine::DataSource::GeoBox GeoRect;

			template< typename T>
			bool IsSamePointOnly2d(const T &first, const T &other)
			{
				return (std::abs(first.x_ - other.x()) < kMathEpsilon &&
					std::abs(first.y_ - other.y()) < kMathEpsilon);
			}
		}
		
		namespace Math{
			typedef DataSource::GeoSegment LineSegment2d;
		}

	}
	/**
	 * @brief Geometry namespace
	 *
	 */
	//namespace Geometry {
	//	typedef Navinfo::Engine::Math::VecBase3d Coordinate;
	//	typedef Navinfo::Engine::Math::AxisAlignedBoxBase< Coordinate > Rect;
	//}
}


